package com.csdj.t309.geamtest.service;

import com.csdj.t309.geamtest.entity.Jifen;
import com.csdj.t309.geamtest.mapper.JifenMapper;
import com.csdj.t309.geamtest.service.IJifenService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 田港
 * @since 2022-01-12
 */
@Service
public class JifenService extends ServiceImpl<JifenMapper, Jifen> implements IJifenService {
    @Resource
    private JifenMapper jifenMapper;

    @Override
    public Integer addJiFen(Jifen jifen) {
        Integer num = jifenMapper.insert(jifen);
        if(num>0){
            return num;
        }
        return 0;
    }

    @Override
    public List<Jifen> selJiFen(Integer jiUserId) {
        HashMap<String,Object> map = new HashMap<>();
        map.put("ji_user_id",jiUserId);
        List<Jifen> list = jifenMapper.selectByMap(map);
        if(list.size()>0){
            return list;
        }
        return null;
    }
}
